package top.mschen.blog.common.utils;

import top.mschen.blog.common.exception.TopChenException;
import top.mschen.blog.dto.BaseResult;

import java.util.Map;

public class ReturnUtils{

    public static BaseResult returnSysFail(Exception e){
        BaseResult<Map<String,Object>> rlt = new BaseResult<Map<String,Object>>();
        rlt.setSuccess(false);
        rlt.setCode("9999");
        rlt.setMessage(e.getMessage());
        return rlt;
    }

    public static  BaseResult returnChenFail(TopChenException e){
        BaseResult<Map<String,Object>> rlt = new BaseResult<Map<String,Object>>();
        rlt.setSuccess(false);
        rlt.setCode(e.getCode());
        rlt.setMessage(e.getMessage());
        return rlt;
    }
}
